<template>
  <div class="user-center">
    <van-nav-bar title="用户中心" left-arrow @click-left="goBack"></van-nav-bar>
    <div class="content">
      <section>
        <van-cell v-model="phone" title="平台账号" value=" "/>
        <van-cell v-if="renzOne" title="身份认证" is-link value="未认证" :to="{name:'identityAuthentication'}"/>
        <van-cell v-if="renzTwo" title="身份认证" is-link value="已认证" :to="{name:'already'}"/>
        <van-cell title="密码设置" is-link :to="{name:'passwordSetting'}"/>
        <van-cell title="账户设置" is-link :to="{name:'accountSetting'}"/>
      </section>
      <div class="login-out">
        <button type="submit" class="submit-btn" @click="logOut">退出登录</button>
      </div>
    </div>
  </div>
</template>
<script>
import Vue from "vue";
import axios from "axios";
import { NavBar, Cell, CellGroup } from "vant";
export default {
  components: {
    [NavBar.name]: NavBar,
    [Cell.name]: Cell,
    [CellGroup.name]: CellGroup
  },
  data() {
    return {
      phone: "",
      renzOne:true,
      renzTwo:false,
    };
  },
  created() {
    this.lookId();
    var tel = this.$store.state.userName;
    var newTel = tel.split("");
    console.log(newTel, 8888);
    newTel.splice(3, 5, "*****");
    this.phone = newTel.join("");
  },
  methods: {
    lookId(){
      console.log(localStorage.getItem('cardId'))
      if( localStorage.getItem('cardId') == 'null'){
        this.renzOne = true
        this.renzTwo = false
      }else{
        this.renzOne = false
        this.renzTwo = true
      }
    },
    //返回上一页
    goBack() {
      this.$router.push({name:'mine'});
    },
    logOut() {
      localStorage.clear();
      sessionStorage.clear()
      this.$store.commit("logOut");
      this.$router.push({ name: "mine" });
    },
    deleteCookies(logininfo){
        localStorage.removeItem(logininfo)
    } 
  }
};
</script>
<style lang="less" scoped>
@import "../../assets/less/variable.less";
.van-cell__title {
  text-align: left;
}
.van-cell::after {
  content: " ";
  position: absolute;
  pointer-events: none;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  left: 0;
  right: 0;
  bottom: 0;
  -webkit-transform: scaleY(0.5);
  transform: scaleY(0.5);
  border-bottom: 1px solid #ebedf0;
}
.user-center {
  background: #fff;
  .content {
    .login-out {
      margin-top: 0.67rem;
      width: 100%;
      background-color: #fff;
      color: #fff;
      font-size: @base_textSize;
      .submit-btn {
         width: 85%;
    height: 34px;
    text-align: center;
    line-height: 34px;
    font-size: 14px;
    background-color: #d6ab6f;
    color: white;
    border-radius: 20px;
    margin: 10vh auto 0;
    border: 0;
      }
    }
  }
}
</style>
